package com.hj.springframework3.after;

import com.hj.springframework3.annotation.Component;
import com.hj.springframework3.aop.AfterInvocationHandlerAdapter;

import java.lang.reflect.Method;

/**
 * @Author : hujing
 * @Date: 2025/7/9 11:46
 * @Description:
 */
@Component
public class PoliteInvocationHandler extends AfterInvocationHandlerAdapter {
    
    @Override
    public Object after(Object proxy, Object result, Method method, Object[] args) {
        if (result instanceof String s){
            if (s.endsWith(".")){
                return s = s.substring(0,s.length()-1)+"!";
            }
        }
        return result;
    }
}
